package drds.server.net.packet;

/**
 * From client to server when the client do heartbeat between cluster.
 * 
 * <pre>
 * Bytes         Name
 * -----         ----
 * 1             command
 * n             id
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class HeartbeatPacket extends Packet {

	public byte command;
	public long id;

	public void read(byte[] bytes) {
		BytesHolder bytesHolder = new BytesHolder(bytes);
		packetLength = bytesHolder.readInt3();
		packetId = bytesHolder.read();
		command = bytesHolder.read();
		id = bytesHolder.readLength();
	}

	@Override
	public int computePacketSize() {
		return 1 + ByteBufferUtil.getLength(id);
	}

}